#include"iostream"

using namespace std;

int n,m;
unsigned int x;

int main()
{
	scanf("%d",&n);
	int num;

	while(n--){
		scanf("%d",&m);
		x = -m;
		num = 0;
		for(int k = 31; k >= 0; k --) if((m >> k & 1) == 1) num++;
		cout << num << " ";
	}
}